package com.zr.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.zr.dao.updateRoleDaocy;
import com.zr.util.JDBCUtil;

public class updateRoleDaoImplcy implements updateRoleDaocy {

	@Override
	public boolean updateRole(int UserName, int UserRole) {
		boolean flg =false;
		StringBuffer sql=new StringBuffer();
		sql.append(" UPDATE `user` SET `user`.rid=?");
		sql.append(" WHERE `user`.uid=?");
		Connection con=JDBCUtil.getConnection();
		try {
			PreparedStatement pst=con.prepareStatement(sql.toString());
			pst.setInt(1, UserRole);
			pst.setInt(2,UserName);
			int b=pst.executeUpdate();
			if(b>0){
				flg=true;
				
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flg;
	}

}
